var app = getApp()
Page({
  data:{
    modalHidden: true,
    current: 0,
  swiper:{
      indicatorDots: false,
      autoplay: false,
      interval: 5000,
      duration: 0
      }
  },
  onPullDownRefresh: function () {
    console.log('onPullDownRefresh')
  },
  onLoad:function(options){
    // 页面初始化 options为页面跳转所带来的参数
    var uid = app.whereId.uid;
    var shopid = app.whereId.shopid;
    var that = this;
    wx.request({
      url: 'https://www.cakeyouxuan.com/small/order/tuikuan',
      data: {
        uid:uid,
        shopid: shopid,
      },
      method: "POST",
      header: {
        "Content-Type": "application/x-www-form-urlencoded"  //post
      },
      success: function (res) {
        console.log(res);
        that.setData({
          cakes:res.data.cakes,
        });
      },
    })
  },
  modalTap: function (e) {
    this.setData({
      modalHidden: false
    })
  },
  modalChange: function (e) {
    this.setData({
      modalHidden: true
    })
  },
  modalTap2: function (e) {
    this.setData({
      modalHidden2: false
    })
  },
  modalChange2: function (e) {
    this.setData({
      modalHidden2: true
    })
  },
  //详情页跳转
  lookdetail:function(e){
    var lookid=e.currentTarget.dataset;
    console.log(e.currentTarget.dataset.id);
    wx.navigateTo({
      url:"/pages/yiguo/detail/detail?id="+lookid.id
    })
  },
  switchSlider:function(e){
    this.setData({
      current:e.target.dataset.index
    })
  },
  changeSlider:function(e){
    this.setData({
      current: e.detail.current
    })
  },
  skip: function (e) {
    var id = e.currentTarget.dataset.id;
    wx.navigateTo({
      url: "/pages/yiguo/refund-2/refund-2?id=" + id,
    })
  },
  comment: function (e) {
    wx.navigateTo({
      url: "/pages/yiguo/comment/comment"
    })
  },
  onReady:function(){
    // 页面渲染完成
  },
  onShow:function(){
    // 页面显示
  },
  onHide:function(){
    // 页面隐藏
  },
  onUnload:function(){
    // 页面关闭
  }

})
